//
//  FZKaiShuDrawView.h
//  MrWrite
//
//  Created by Founder MAC on 14-12-17.
//  Copyright (c) 2014年 Founder. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>

// 笔形
typedef NS_ENUM (NSInteger, HandwritingType) {
    HandwritingType_langhao = 3,  // 毛笔（狼毫）
    HandwritingType_yanghao = 4,  // 毛笔（羊毫）
};

// 书写模式
typedef NS_ENUM(NSInteger, WritingMode) {
    WritingMode_Speed = 0,          // 仅速度
    WritingMode_Force = 1,          // 仅压感
    WritingMode_SpeedAndForce = 2,  // 速度和压感
};

typedef NS_ENUM (NSInteger, DrawingState) {
    DrawingState_Began     = 0,
    DrawingState_Changed   = 1,
    DrawingState_Ended     = 2,
    DrawingState_Cancelled = 3,
};



@interface MyPoint : NSObject

@property (nonatomic, assign)CGPoint   my_prePoint;          // 前一个点坐标
@property (nonatomic, assign)CGPoint   my_nextPoint;         // 当前点坐标
@property (nonatomic, assign)UInt64    my_preTime;           // 前一点时间
@property (nonatomic, assign)UInt64    my_nextTime;          // 当前点时间
@property (nonatomic, assign)CGFloat   my_preWidth;          // 前一点宽度
@property (nonatomic, assign)CGFloat   my_nextWidth;         // 当前点宽度

@end

@interface FZKaiShuDrawView : UIView


- (void)p_setBrushWidth:(CGFloat)brushWidth;         //设置笔宽
- (void)p_setBrushColor:(UIColor*)color;            //设置画笔颜色
- (void)p_setBrushMode:(WritingMode)writingMode;     //设置书写模式
- (void)p_clearTheScreen;                            //清空内容
- (void)p_undo;                                      //撤销
- (UIImage *)p_getDrawImage;                         //获取缓冲区图像

@property (nonatomic, assign) HandwritingType handwritingType;
@property (nonatomic, copy) void (^scoreBlock)(UIImage *image);
- (void)drawWithPoint:(CGPoint)location state:(DrawingState)state andTimestamp:(NSTimeInterval)timestamp;

@end
